#!/usr/bin/env python
import SimpleXMLRPCServer, os, logging



def printTest (self):
	print 'test'
       	return 'test'

logging.basicConfig(level=logging.DEBUG)

server = SimpleXMLRPCServer.SimpleXMLRPCServer(("palm04.csc.ncsu.edu", 9000), logRequests=True)
server.register_function(printTest)

#Go into the main listener loop
print "Listening on port 8888"

# Expose a function
def list_contents(dir_name):
    logging.debug('list_contents(%s)', dir_name)
    return os.listdir(dir_name)
server.register_function(list_contents)

try:
    print 'Serving forever. Use Control-C to exit'
    server.serve_forever()
except KeyboardInterrupt:
    print 'Exiting'
